package 华为测试;

import java.util.Scanner;

/**
 * Created by hest0 on 2017/7/10.
 */
public class 坐标移动2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            System.out.println(func(s));
        }
        sc.close();
    }

    private static String func(String s) {
        int x = 0;
        int y = 0;
        String[] a = s.split(";");
        for (int i = 0; i < a.length; i++) {
            if (a[i].matches("[ADWS]{1}[0-9]{1,2}")) {
                char c = a[i].charAt(0);
                int step = Integer.parseInt(a[i].substring(1));
                switch (c) {
                    case 'A':
                        x -= step;
                        break;
                    case 'D':
                        x += step;
                        break;
                    case 'W':
                        y += step;
                        break;
                    case 'S':
                        y -= step;
                        break;
                }
            }
        }
        return x + "," + y;
    }
}
